package com.arpa.wms.domain.enums;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.enums.IEnum;

import java.util.HashMap;
import java.util.Map;

/**
 * 上架单明细状态
 * @program: wms
 * @description:
 * @author: xuyang
 * @create: 2020-08-20 10:21
 */
public enum PutawayItemStatusEnum implements IEnum<String> {
    /**
     * 上架单明细状态， 上架确认单也可使用（没有上架中状态）
     */
    WAITING("0", "待上架"),
    PUTAWAYING("1", "上架中"),
    FINISH("2", "已上架");

    /**
     * 值
     */
    private final String value;

    /**
     * 描述
     */
    private final String desc;

    PutawayItemStatusEnum(final String value, final String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static String translate(String value){
        PutawayItemStatusEnum item = map.get(value);
        if(item != null){
            return item.getDesc();
        }
        return StrUtil.EMPTY;
    }

    private static final Map<String, PutawayItemStatusEnum> map = new HashMap();

    static {
        for(PutawayItemStatusEnum item: values()){
            map.put(item.getValue(), item);
        }
    }

    public static PutawayItemStatusEnum getEnumByValue(String value) {
        return map.get(value);
    }

    @Override
    public String getValue() {
        return this.value;
    }

    @Override
    public String toString(){
        return this.desc;
    }

    public String getDesc() {
        return this.desc;
    }
}
